using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AXBC = Microsoft.Dynamics.BusinessConnectorNet;
using AXMD = Microsoft.Dynamics.Framework.Metadata.Ax;
using Proxy = Microsoft.Dynamics.Framework.BusinessConnector.Proxy;

namespace DynamicsAXPS
{
    [System.Management.Automation.Cmdlet("Import", "ExcelWorksheet")]
    public class Import_ExcelWorksheet : System.Management.Automation.PSCmdlet
    {
        [System.Management.Automation.Parameter(Position = 0, Mandatory = true)]
        public string Filename;

        [System.Management.Automation.Parameter(Position = 1, Mandatory = true)]
        public string Worksheet;

        protected override void ProcessRecord()
        {
            var datatable = DynamicsAXUtil.DataTableUtil.FromExcelWorksheet(this.Filename, this.Worksheet, true);
            this.WriteObject(datatable);
        }
    }
}
